#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    //ios_base::sync_with_stdio(false);cin.tie(nullptr);
    string in;
    while(cin >> in){
        vector<string> c1(3, string()), c2(3, string());
        for(int i=0; i<3; ++i){
            c1[i].push_back(in[i]), c1[i].push_back(in[5-i]);
        }
        for(int i=0; i<3; ++i){
            c2[i].push_back(in[i+6]), c2[i].push_back(in[5-i+6]);
        }
        bool find;
        string zero = "00";
        for(int i=0; i<3; ++i){
            find = false;
            for (int j = 0; j < 3; ++j) {
                string rev; rev.push_back(c2[j][1]); rev.push_back(c2[j][0]);
                if(c1[i]==c2[j] || c1[i]==rev){
                    c1[i] = c2[j] = zero; find = true;
                }
            }
            if(!find) break;
        }
        if(find)cout << "TRUE\n";
        else cout << "FALSE\n";
    }
    return 0;
}